{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "411d26b8-8b0f-4c71-8a66-476dfd2756f4",
   "metadata": {},
   "outputs": [],
   "source": [
    "from IPython.core.interactiveshell import InteractiveShell\n",
    "InteractiveShell.ast_node_interactivity = \"all\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d3a81fd4-74a4-48b8-91d1-2f40f76310dd",
   "metadata": {},
   "outputs": [],
   "source": [
    "pip install jupytext plotly resource-usage pyviz"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "3fe1284b-17cc-4ca3-8124-3ae79b99d305",
   "metadata": {},
   "outputs": [],
   "source": [
    "import warnings\n",
    "warnings.filterwarnings('ignore')\n",
    "#warnings.filterwarnings(action, message='', category=Warning, module='', lineno=0, append=False)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "78f7aa32-8450-4bd8-a956-cdd37bb435d1",
   "metadata": {},
   "source": [
    "在conda命令中，`-n` 是一个选项，用于指定环境名称。这是创建新环境时必须使用的选项。`-n` 后面紧跟的是你想要创建的环境的名称。\n",
    "例如，如果你想创建一个名为 \"myenv\" 的环境，你会使用以下命令：\n",
    "```bash\n",
    "conda create -n myenv\n",
    "```\n",
    "除了 `-n` 之外，还有一些其他常用的选项：\n",
    "- `-y`：这个选项告诉conda自动回答所有提示为“yes”。通常，当conda询问你是否想要继续时，你需要手动输入 `y` 来确认。使用 `-y` 选项，conda会自动假定你回答“yes”，这样在自动化脚本中非常有用，因为它会跳过所有确认步骤。\n",
    "例如，如果你想在不收到任何提示的情况下创建一个新环境，你可以使用：\n",
    "```bash\n",
    "conda create -n myenv -y\n",
    "```\n",
    "- `--name`：这个选项与 `-n` 选项相同，用于指定环境名称。如果你不喜欢使用短选项，可以使用长选项 `--name`。\n",
    "例如，使用长选项创建环境：\n",
    "```bash\n",
    "conda create --name myenv\n",
    "```\n",
    "- `--clone`：这个选项用于克隆一个已存在的环境。后面需要跟上要克隆的环境的名称以及新环境的名称。\n",
    "例如，克隆一个名为 \"oldenv\" 的环境到新环境 \"newenv\"：\n",
    "```bash\n",
    "conda create --name newenv --clone oldenv\n",
    "```\n",
    "- `--prefix`：这个选项用于指定环境的路径。如果你想要创建的环境不在conda默认的目录下，可以使用这个选项。\n",
    "例如，创建一个环境到特定的目录：\n",
    "```bash\n",
    "conda create --prefix /path/to/myenv\n",
    "```\n",
    "这些选项可以组合使用，以满足你的特定需求。例如，你可以同时指定环境名称和自动确认所有提示：\n",
    "```bash\n",
    "conda create -n myenv --yes\n",
    "```\n",
    "或者使用长选项：\n",
    "```bash\n",
    "conda create --name myenv --yes\n",
    "```\n",
    "这些选项提供了灵活的方式来管理conda环境。\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "03fbcc62-0dab-48df-9947-fea78b11c7e7",
   "metadata": {
    "tags": []
   },
   "source": [
    "## Jupyter notebook切换运行环境，并使用该环境"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a9da090d-8e02-4bfe-92d3-57881df51002",
   "metadata": {},
   "outputs": [],
   "source": [
    "conda activate env\n",
    "conda install ipykernel\n",
    "python -m ipykernel install --user --name 本地环境名称 --display-name \"在jupyter上显示的环境名称\""
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
